﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;


namespace ray2010
{
    public class OutputFileGenerator
    {
        private Ray2010 ray2010;
        private string filename;
        public OutputFileGenerator(Ray2010 ray2010, string filename)
        {
            this.ray2010 = ray2010;
            this.filename = filename;
            
        }

        public void Write(string Lines)
        {
            
            Write(Lines);
            
        }

        public void WriteNodes()
        {
            StreamWriter streamWriter = new StreamWriter(filename);
            if (ray2010.nodes != null)
            {
                foreach (Node node in ray2010.nodes)
                {
                    if (node.GetConnectedNotes() != null)
                    {
                        foreach (Node connectedNodes in node.GetConnectedNotes())
                        {
                            streamWriter.WriteLine(node.GetAbsolutePosition().ToString() + " " + connectedNodes.GetAbsolutePosition().ToString());                           
                        }
                    }
                }
            }
            streamWriter.Close();
        }
    }

}

